package com.coderman.basketball.infrast.mq.consumer;

import com.alibaba.fastjson.JSON;
import com.coderman.basketball.domain.model.trade.event.TradeApplyResultEvent;
import com.coderman.basketball.infrast.mq.MqConsumeHandler;
import com.coderman.basketball.infrast.mq.annotation.MqConsumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

/**
 * Description:
 * date: 2021/5/24
 *
 * @author shenshuai
 * @version 1.0.0
 * @since JDK 1.8
 */
@MqConsumer(topic = "",msgTag = "")
public class TradeApplyResultHandler implements MqConsumeHandler {
    /*
      容器事件由容器触发
     */
    @Autowired
    private ApplicationContext applicationContext;

    @Override
    public void consumeMq(String mqBody) {
        TradeApplyResultEvent event = JSON.parseObject(mqBody,TradeApplyResultEvent.class);
        applicationContext.publishEvent(event);
    }
}
